<!--[*
// ----------------------------------------------------------------------
// Source file:  $Source: /cvsroot/pn-commerce/pn-commerce/pntemplates/pncommerce_user_userinfo.html,v $
//
// Last changes from:  $Author: landseer $
//
// Revision:           $Revision: 1.40 $
//
// Date of revision    $Date: 2005/03/21 16:33:12 $
//
// Used in: pncommerce&function=userinfo 
// The screen where the customer enters his shipping address
//
// ----------------------------------------------------------------------
//
// called from: pncommerce_user_userinfo
// task: beginning of the checkout, ask the basic user information (and shows what we know about
//       the user if he has ordered something before
*]-->
<!--[* debug *]-->
<!--[ include file='pncommerce_user_checkoutheader.html' ]-->
<!--[ pncSetBacklinkPoint ]-->
<script type="text/javascript">
<!--
function checkForm(form)
{
<!--[ pncFormValidate Field='CName' Message=_PNC_YOURNAME ]-->
<!--[ pncFormValidate Field='BuyAddress1' Message=_PNC_YOURADDRESS ]-->
<!--[ pncFormValidate Field='BuyZip' Message=_PNC_YOURCITYSTATEZIP ]-->
<!--[ pncFormValidate Field='BuyCity' Message=_PNC_YOURCITYSTATEZIP ]-->
<!--[* pncFormValidate Field='BuyCountry' Message=_PNC_YOURCOUNTRY FieldType=dropdown *]-->
<!--[ pncFormValidate Field='BuyEmail' Message=_PNC_YOUREMAIL ]-->
<!--[ pncFormValidate Field='DayPhone' Message=_PNC_DAYTIMEPHONE ]-->
<!--[ pncFormValidate Field='EvePhone' Message=_PNC_EVENINGPHONE ]-->

    if(form.UseShipTo.checked == true)
    {
        <!--[ pncFormValidate Field='ShipToName' Message=_PNC_SHIPTONAME ]-->
        <!--[ pncFormValidate Field='ShipToAddress1' Message=_PNC_YOURADDRESS ]-->
        <!--[ pncFormValidate Field='ShipToZip' Message=_PNC_YOURCITYSTATEZIP ]-->
        <!--[ pncFormValidate Field='ShipToCity' Message=_PNC_YOURCITYSTATEZIP ]-->
        <!--[ pncFormValidate Field='ShipToCountry' Message=_PNC_YOURCOUNTRY ]-->
    }
}

function populate(userinfo, selected) 
{

  var states = "<!--[ pnml name='_PNC_SELECTSTATE' ]-->,<!--[ pnml name='_PNC_USSTATES' ]-->";
  var stateArray = states.split(",");
  var provinces = "<!--[ pnml name='_PNC_SELECTPROVINCE' ]-->,<!--[ pnml name='_PNC_CAPROVINCES' ]-->";
  var provinceArray = provinces.split(",");
  var ukcounty = "<!--[ pnml name='_PNC_SELECTCOUNTY' ]-->,<!--[ pnml name='_PNC_UKCOUNTIES' ]-->";
  var ukcountyArray = ukcounty.split(",");

  var noArray = new Array("('--------------------','',true,true)");

  if (selected == '<!--[ pnml name='_PNC_USA' ]-->')
  {
    userinfo.BuyState.style.display="inline";
    for (var i=0; i < stateArray.length; i++) 
    {
        if (stateArray[i] == "<!--[ $User.State ]-->")
        {
            newstate = new Option( stateArray[i], stateArray[i], true, true );
        }
        else
        {
            newstate = new Option( stateArray[i], stateArray[i], false, false );
        }
        userinfo.BuyState.options[i] = newstate;
	}
	return;
  }

  if (selected == '<!--[ pnml name='_PNC_CANADA' ]-->') 
  {
    userinfo.BuyState.style.display="inline";
    while (provinceArray.length < userinfo.BuyState.options.length) 
    {
        userinfo.BuyState.options[(userinfo.BuyState.options.length - 1)] = null;
    }
    for (var i=0; i < provinceArray.length; i++) 
    {
        if (provinceArray[i] == "<!--[ $User.State ]-->")
        {
            newprovince = new Option( provinceArray[i], provinceArray[i], true, true );
        }
        else
        {
            newprovince = new Option( provinceArray[i], provinceArray[i], false, false );
        }
        userinfo.BuyState.options[i] = newprovince;
	}
	return;
  }
  	
  if (selected == '<!--[ pnml name='_PNC_UNITEDKINGDOM' ]-->') 
  {
    userinfo.BuyState.style.display="inline";
    while (ukcountyArray.length < userinfo.BuyState.options.length) 
    {
        userinfo.BuyState.options[(userinfo.BuyState.options.length - 1)] = null;
    }
    for (var i=0; i < ukcountyArray.length; i++) 
    {
        if (ukcountyArray[i] == "<!--[ $User.State ]-->")
        {
            newukcounty = new Option( ukcountyArray[i], ukcountyArray[i], true, true );
        }
        else
        {
            newukcounty = new Option( ukcountyArray[i], ukcountyArray[i], false, false );
        }
        userinfo.BuyState.options[i] = newukcounty;
	}
	return;	
	
  }
  userinfo.BuyState.style.display="none";
}

function populateShipTo(userinfo, selected) 
{

  var states = "<!--[ pnml name='_PNC_SELECTSTATE' ]-->,<!--[ pnml name='_PNC_USSTATES' ]-->";
  var stateArray = states.split(",");
  var provinces = "<!--[ pnml name='_PNC_SELECTPROVINCE' ]-->,<!--[ pnml name='_PNC_CAPROVINCES' ]-->";
  var provinceArray = provinces.split(",");
  var ukcounty = "<!--[ pnml name='_PNC_SELECTCOUNTY' ]-->,<!--[ pnml name='_PNC_UKCOUNTIES' html=1 ]-->";
  var ukcountyArray = ukcounty.split(",");

  var noArray = new Array("('--------------------','',true,true)");

  if (selected == '<!--[ pnml name='_PNC_USA' ]-->')
  {
    userinfo.ShipToState.style.display="inline";
    for (var i=0; i < stateArray.length; i++) 
    {
        if (stateArray[i] == "<!--[ $User.State ]-->")
        {
            newstate = new Option( stateArray[i], stateArray[i], true, true );
        }
        else
        {
            newstate = new Option( stateArray[i], stateArray[i], false, false );
        }
        userinfo.ShipToState.options[i] = newstate;
	}
	return;
  }

  if (selected == '<!--[ pnml name='_PNC_CANADA' ]-->') 
  {
    userinfo.ShipToState.style.display="inline";
    while (provinceArray.length < userinfo.ShipToState.options.length) 
    {
        userinfo.ShipToState.options[(userinfo.ShipToState.options.length - 1)] = null;
    }
    for (var i=0; i < provinceArray.length; i++) 
    {
        if (provinceArray[i] == "<!--[ $User.ShipToState ]-->")
        {
            newprovince = new Option( provinceArray[i], provinceArray[i], true, true );
        }
        else
        {
            newprovince = new Option( provinceArray[i], provinceArray[i], false, false );
        }
        userinfo.ShipToState.options[i] = newprovince;
	}
	return;
  }

  if (selected == '<!--[ pnml name='_PNC_UNITEDKINGDOM' ]-->') 
  {
    userinfo.ShipToState.style.display="inline";
    while (ukcountyArray.length < userinfo.ShipToState.options.length) 
    {
        userinfo.ShiToState.options[(userinfo.ShipToState.options.length - 1)] = null;
    }
    for (var i=0; i < ukcountyArray.length; i++) 
    {
        if (ukcountyArray[i] == "<!--[ $User.ShipTotate ]-->")
        {
            newukcounty = new Option( ukcountyArray[i], ukcountyArray[i], false, false );
        }
        else
        {
            newukcounty = new Option( ukcountyArray[i], ukcountyArray[i], false, false );
        }
        userinfo.ShipToState.options[i] = newukcounty;	
	}
	return;
		
  }
  userinfo.ShipToState.style.display="none";
}

function init() {
   document.userinfo.BuyCountry.onchange();
   document.userinfo.ShipToCountry.onchange();
}
 
 // this will be fired _after_ the window has loaded. We need this to find out the initial country and if we have to show states or provinces.
 window.onload = init;
//-->
</script>

<!-- start userinfo -->

<!--[ pncGetConfigSupplier ]-->

<!--[ pnml name='_PNC_CHECKOUT'  ]-->: <!--[ pnml name='_PNC_PLEASEFILLOUTINFOBELOW' ]-->:
<br><br>

<FORM name="userinfo" ACTION="<!--[ pncUserModURL func=userinforesponse ]-->" METHOD="POST" onSubmit="return checkForm(this)">
<input type="hidden" name="authid" value="<!--[pnsecgenauthkey module="pncommerce"]-->">

<table width="80%">

    <tr>
        <td ALIGN="right">
            <!--[ pnml name='_PNC_YOURCOUNTRY' ]-->
        </td>
		<td ALIGN="left">
            <select name="BuyCountry" onChange="populate(document.userinfo,document.userinfo.BuyCountry.options[document.userinfo.BuyCountry.selectedIndex].value)">
            <!--[* pncCountrySelectlist SelectedCountry=$User.Country *]-->
             <!--[ if ($User.Country) ]-->
               <!--[ pncCountrySelectlist SelectedCountry=$User.Country ]-->
             <!--[ else ]-->
               <!--[ pncCountrySelectlist SelectedCountry=$shopConfigSupplier.Country ]-->
             <!--[ /if ]-->
            </select>

		</td>
    </tr>

<tr><td></td><td></td></tr>

    <tr>
        <td ALIGN="right">
            <!--[ pnml name='_PNC_YOURNAME' ]-->
        </td>
        <td ALIGN="left">
            <INPUT TYPE="text" NAME="CName" VALUE="<!--[ $User.Name ]-->" SIZE="40">
        </td>
    </tr>

    <tr>
        <td ALIGN="right">
            <!--[ pnml name='_PNC_YOURADDRESS' ]-->
        </td>
        <td ALIGN="left">
            <INPUT TYPE="text" NAME="BuyAddress1" VALUE="<!--[ $User.Address1 ]-->" SIZE="40">
        </td>
    </tr>

    <tr>
        <td>&nbsp;
            
        </td>
        <td>
            <INPUT TYPE="text" NAME="BuyAddress2" VALUE="<!--[ $User.Address2 ]-->" SIZE="40">
        </td>
    </tr>

    <tr>
        <td ALIGN="right">
            <!--[ pnml name='_PNC_YOURCITYSTATEZIP' ]-->
        </td>

      <td ALIGN="left"> 
            <INPUT TYPE="text" NAME="BuyCity" VALUE="<!--[ $User.City ]-->" SIZE="25">
            <select name="BuyState" style="display: <!--[ if (($User.Country==$Canada)OR($User.Country==$USA)OR($User.Country==$UnitedKingdom)) ]-->inline<!--[ else ]-->none<!--[ /if ]-->;">
            <!--[ pncStateSelectlist SelectedState=$User.State Country=$User.Country ]-->
            </select>
			<INPUT TYPE="text" NAME="BuyZip" VALUE="<!--[ $User.Zip ]-->" SIZE="7" MAXLENGTH="12">
      </td>
    </tr>
    


	<tr>
	    <td ALIGN="right">
	        <!--[ pnml name='_PNC_YOUREMAIL' ]-->
	    </td>
	    <td ALIGN="left">
	        <INPUT TYPE="text" NAME="BuyEmail" VALUE="<!--[ $User.Email ]-->" SIZE="40">
	    </td>
	</tr>
	
	<tr>
	    <td ALIGN="right">
	        <!--[ pnml name='_PNC_DAYTIMEPHONE' ]-->
	    </td>
	    <td ALIGN="left">
	        <INPUT TYPE="text" NAME="DayPhone" VALUE="<!--[ $User.DayPhone ]-->" SIZE="40">
	    </td>
	</tr>
	
	<tr>
	    <td ALIGN="right">
	        <!--[ pnml name='_PNC_EVENINGPHONE' ]-->
	    </td>
	    <td ALIGN="left">
	        <INPUT TYPE="text" NAME="EvePhone" VALUE="<!--[ $User.EvePhone ]-->" SIZE="40">
	    </td>
	</tr>
	
	<tr>
	    <td align="right">
	        <!--[ pnml name='_PNC_COMMENTS' ]-->
	    </td>
        <td>
            <textarea rows='3' cols='50' name='Comments'></textarea>
        </td>
    </tr>
	
	<tr>
	    <td colspan='2'>&nbsp;
	        
	    </td>
	</tr>

	<tr>
	    <td align="right">
	        <b><!--[ pnml name='_PNC_TAXEXEMPT' ]--></b>
	    </td>
	    <td>
	        <input type="checkbox" name="TaxExempt" value="checked" <!--[ $User.TaxExempt ]-->>&nbsp;
	    </td>
	</tr>

	<tr>
	    <td align="right">
	        <b><!--[ pnml name='_PNC_VATIDENTNUMBER' ]--></b>
	    </td>
	    <td>
	        <input type="text" name="VATIdentNumber" value=<!--[ $User.VATIdentnumber ]-->>
	    </td>
	</tr>

    <tr>
        <td align="right" valign="top">
            <b><!--[ pnml name='_PNC_RESIDENTIALORCOMMERCIAL' ]--></b>
        </td>
        <td align="left" valign="top">
            <input type="radio" name="rescom" value="RES" checked="checked"><!--[ pnml name='_PNC_RESIDENTIALADDRESS' ]--><br />
            <input type="radio" name="rescom" value="COM"><!--[ pnml name='_PNC_COMMERCIALADDRESS' ]--><br />
        </td>
	</tr>
	
	<tr>
	    <td>
	        <b><!--[ pnml name='_PNC_USEALTERNATESHIPTOADDRESS' ]--></b>
	    </td>
	    <td>
	        <input type="checkbox" name="UseShipTo" value="checked" <!--[ $User.UseShipTo ]-->>&nbsp;
	    </td>
	</tr>
	
	<tr>
	    <td colspan='2'>&nbsp;
	        
	    </td>
    </tr>

    <tr>
        <td ALIGN="right">
            <!--[ pnml name='_PNC_YOURCOUNTRY' ]-->
        </td>
		<td ALIGN="left">
            <select name="ShipToCountry" onChange="populateShipTo(document.userinfo,document.userinfo.ShipToCountry.options[document.userinfo.ShipToCountry.selectedIndex].value)">
            <!--[* pncCountrySelectlist SelectedCountry=$User.ShipToCountry *]-->
             <!--[ if ($User.ShipToCountry) ]-->
                 <!--[ pncCountrySelectlist SelectedCountry=$User.ShipToCountry ]-->
             <!--[ else ]-->
                 <!--[ pncCountrySelectlist SelectedCountry=$shopConfigSupplier.Country ]-->
             <!--[ /if ]-->
            </select>

		</td>

<tr><td></td><td></td></tr>
	
 	<tr>
 	    <td ALIGN="right">
 	        <!--[ pnml name='_PNC_SHIPTONAME' ]-->
 	    </td>
	    <td ALIGN="left">
	        <INPUT TYPE="text" NAME="ShipToName" VALUE="<!--[ $User.ShipToName ]-->" SIZE="40">
	    </td>
	</tr>
    
    <tr>
        <td ALIGN="right">
            <!--[ pnml name='_PNC_YOURADDRESS' ]-->
        </td>
	    <td ALIGN="left">
	        <INPUT TYPE="text" NAME="ShipToAddress1" VALUE="<!--[ $User.ShipToAddress1 ]-->" SIZE="40">
	    </td>
	</tr>
	
	<tr>
	    <td>&nbsp;
	        
	    </td>
	    <td>
	        <INPUT TYPE="text" NAME="ShipToAddress2" VALUE="<!--[ $User.ShipToAddress2 ]-->" SIZE="40">
	    </td>
	</tr>
	
	<tr>
	    <td ALIGN="right">
	        <!--[ pnml name='_PNC_YOURCITYSTATEZIP' ]-->
	    </td>
      	<td ALIGN="left">
      	    <INPUT TYPE="text" NAME="ShipToCity" VALUE="<!--[ $User.ShipToCity ]-->" SIZE="25">
            <select name="ShipToState" style="display: <!--[ if (($User.ShipToCountry==$Canada)OR($User.ShipToCountry==$USA)) ]-->inline<!--[ else ]-->none<!--[ /if ]-->;">
            <!--[ pncStateSelectlist SelectedState=$User.ShipToState Country=$User.ShipToCountry ]-->
            </select>
			<INPUT TYPE="text" NAME="ShipToZip" VALUE="<!--[ $User.ShipToZip ]-->" SIZE="7" MAXLENGTH="12">
      	</td>
   </tr>
    	
	<tr>
	    <td height='30' colspan="2" align="MIDDLE">
	        <INPUT TYPE="SUBMIT" VALUE="<!--[ pnml name='_PNC_NEXTSTEP' ]-->" onSubmit='style="COLOR:FF00FF"'>
	   	</td>
	</tr>
</table>

</FORM>

<!-- end userinfo -->
<!--[ include file='pncommerce_user_commonFooter.html' ]-->
